﻿@using SCMS.Resources
@model SCMS.UI.Models.ViewCC
<div class="partialViewCard">
    <div class="partialViewCardHeader">
        <h3>
            N0.:
            @if (Model.EntityCC.IsSubmitted)
            {
                @Model.EntityCC.RefNumber
            }
        </h3>
    </div>
    <br />
    <table width="98%" align="center" cellspacing="0" cellpadding="0">
        <tr>
            <td align="left">
                <strong>@Resources_frank.Global_String_Date</strong>
            </td>
            <td align="left" colspan="3">
                @Model.EntityCC.PreparedOn.Value.ToString("dd/MM/yyyy")
            </td>
        </tr>
        <tr>
            <td align="left">
                <strong>@Resources_frank.Global_String_Office:</strong>
            </td>
            <td align="left">
                @Model.EntityCC.CountrySubOffice.Name
            </td>
            <td align="left">
                <strong>@Resources_frank.Global_String_Country:</strong>
            </td>
            <td align="left">
                @Model.EntityCC.CountrySubOffice.CountryProgramme.Country.Name
            </td>
        </tr>
        <tr>
            <td align="left">
                <strong>@Resources_frank.Global_String_PreparedBy:</strong>
            </td>
            <td align="left">
                @Model.PreparedBy.StaffName
            </td>
            <td align="left">
                <strong>@Resources_frank.Global_String_Title:</strong>
            </td>
            <td align="left">
                @Model.PreparedBy.Designation
            </td>
        </tr>
        <tr>
            <td align="left">
                <strong>@Resources_frank.Global_String_Signature:</strong>
            </td>
            <td align="left" colspan="3">
                @if (Model.PreparedBy != null && Model.PreparedBy.SignatureImage != null)
                { 
                    <img src="@Url.Action("Photo", "Person", new { id = Model.PreparedBy.PersonID, area = "" })" alt="" style="max-width: 100px;" />
                }
            </td>
        </tr>
        <tr>
            <td align="left">
                <strong>@Resources_frank.Global_String_SubjectPurpose:</strong>
            </td>
            <td align="left" colspan="3">
                @Model.EntityCC.Purpose
            </td>
        </tr>
    </table>
    <br />
    @{bool iscompleted = false, isoutstandingissues = false, isnotcompleted = false;
      if (Model.EntityCC.WorksService == Resources_frank.CompletionCertificate_LoadCC_CompletedSatisfactorily)
      {
          iscompleted = true;
      }
      else if (Model.EntityCC.WorksService == Resources_frank.CompletionCertificate_LoadCC_OutstandingIssues)
      {
          isoutstandingissues = true;
      }
      else 
      {
          isnotcompleted = true;
      }
    }
    <table width="98%" align="center" cellspacing="0" cellpadding="0" border="1">
        <tr>
            <td>
                <br />
                <table width="100%" align="center" cellspacing="0" cellpadding="0">
                    <tr>
                        <td style="width: 40%;">
                            <strong>@Resources_frank.CompletionCertificate_ViewCC_Constructor:</strong>
                        </td>
                        <td>@Model.EntityCC.PurchaseOrder.Supplier.Name
                        </td>
                    </tr>
                </table>
                <br />
                <table width="100%" align="center" cellspacing="0" cellpadding="0">
                    <tr>
                        <td style="width: 40%;">
                            <strong>Contract/PO No:</strong>
                        </td>
                        <td>@Model.EntityCC.PurchaseOrder.RefNumber
                        </td>
                    </tr>
                </table>
                <br />
                <table width="100%" align="center" cellspacing="0" cellpadding="0">
                    <tr>
                        <td style="width: 40%;">
                            <strong>@Resources_frank.Global_String_ProjectTitle:</strong>
                        </td>
                        <td>@Model.EntityCC.ProjectTitle
                        </td>
                    </tr>
                </table>
                <br />
                <table width="100%" align="center" cellspacing="0" cellpadding="0">
                    <tr>
                        <td style="width: 40%;">
                            <strong>@Resources_frank.Global_String_Location:</strong>
                        </td>
                        <td>@Model.EntityCC.Location
                        </td>
                    </tr>
                </table>
                <br />
                <table width="100%" align="center" cellspacing="0" cellpadding="0">
                    <tr>
                        <td style="width: 40%;">
                            <strong>@Resources_frank.Global_String_DRCOffice:</strong>
                        </td>
                        <td>@Model.EntityCC.CountrySubOffice1.Name
                        </td>
                    </tr>
                </table>
                <br />
                <table width="100%" align="center" cellspacing="0" cellpadding="0">
                    <tr>
                        <td style="width: 40%;">
                            <strong>@Resources_frank.CompetionCertificate_ViewCCDetails_ServiceConfirmedBy:</strong>
                        </td>
                        <td>@Model.ComfirmedBy.StaffName
                        </td>
                    </tr>
                </table>
                <br />
                <table width="100%" align="center" cellspacing="0" cellpadding="0">
                    <tr>
                        <td style="width: 40%;">
                            <strong>@Resources_frank.CompletionCertificate_LoadCC_ServiceWorks:</strong>
                        </td>
                        <td>
                            <table width="98%" align="center" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td valign="middle">
                                        @Html.CheckBox("Completed satisfactory", @iscompleted, new { @disabled = "disabled" })
                                        Completed satisfactory
                                    </td>
                                    <td>
                                        @Html.CheckBox("Outstanding issues", @isoutstandingissues, new { @disabled = "disabled" })
                                        Outstanding issues
                                    </td>
                                    <td>
                                        @Html.CheckBox("not completed", @isnotcompleted, new { @disabled = "disabled" })
                                        Not Completed
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
                <br />
                <table width="100%" align="center" cellspacing="0" cellpadding="0">
                    <tr>
                        <td style="width: 40%;">
                            <strong>@Resources_frank.CompletionCertificate_LoadCC_Remarks:</strong>
                        </td>
                        <td>@Model.EntityCC.Remarks
                        </td>
                    </tr>
                </table>
                <br />
            </td>
        </tr>
    </table>
    <br />
    <table width="98%" align="center" cellspacing="0" cellpadding="0" class="cardTable">
        <tr>
            <td style="width: 20%;">
                @Resources_frank.Global_String_ApprovedBy (@Resources_frank.Global_String_Title):
            </td>
            <td>
                @if (Model.AprovedBy != null)
                {
                    @Model.AprovedBy.Designation
                }
            </td>
        </tr>
        <tr>
            <td style="width: 20%;">
                @Resources_frank.Global_String_Name:
            </td>
            <td>
                @if (Model.AprovedBy != null)
                {
                    @Model.AprovedBy.StaffName
                }
            </td>
        </tr>
        <tr>
            <td style="width: 20%;">
                @Resources_frank.Global_String_Signature:
            </td>
            <td>
                @if (Model.AprovedBy != null && Model.AprovedBy.SignatureImage != null)
                { 
                    <img src="@Url.Action("Photo", "Person", new { id = Model.AprovedBy.PersonID, area = "" })" alt="" style="max-width: 100px;" />
                }
            </td>
        </tr>
    </table>
    <hr />
    @if (Model.EntityCC.IsApproved == true)
    {

        <a class="btn btn-primary"  href="@Url.Action("Index", "CompletionC", new { area = "Reports", CCid = Model.EntityCC.Id })" target="_blank" style="margin-left: 48%; margin-bottom: 2%;">
            @Resources_frank.Budget_ViewBudget_DownloadPdf</a>
        <br />
    }
    @if (!Model.EntityCC.IsSubmitted)
    {
        
        <center>
            <input type="button" class="btn green" value="  @Resources_frank.Global_String_SubmitForApproval  " onclick="sendRequest('SubmitCC/@Model.EntityCC.Id', 'CompletionDiv', 'loading');if (document.getElementById('table') != null) {initSorter(); sorter.size(20); }" />
        </center>
    }
</div>
<p>
    @Html.ActionLink(Resources_frank.Global_String_BackToList, "Index")
</p>
